﻿@{
    ViewBag.Title = "PreparBlankEnterInput";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script>
    $(function () {
        initControl();
        gridList();
    });
    function initControl() {
        $('select').bindSelect();
    }
    function editText(item)
    {
        var node = item.parentNode;
        node.innerHTML = '<input type="text" value="" style="width:97px"><span onclick="btn_add();">...</span>';
    }
    function selectText(cellvalue, options, rowObject) {
        if (cellvalue == undefined)
        {
            cellvalue = " ";
        }
        return '<div class="table_celltext" name="F_Id" onclick="editText(this);">'+cellvalue+'</div>';
    }
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            //url: "/SystemManage/User/GetGridJson",
            height: $(window).height() - 180,
            colModel: [
            { label: "零件编号", name: "F_Id", width: 120, align: 'left',formatter:selectText },
            { label: "零件名称", name: "F_Id", width: 120, align: 'left' },
            { label: "实际材料", name: "F_Id", width: 120, align: 'left' },
            { label: "实际规格", name: "F_Id", width: 120, align: 'left' },
            { label: "剪切规格", name: "F_Id", width: 120, align: 'left' },
            { label: "毛坯尺寸", name: "F_Id", width: 120, align: 'left' },
            { label: "工艺材料", name: "F_Id", width: 120, align: 'left' },
            { label: "工艺规格", name: "F_Id", width: 120, align: 'left' },
            { label: "标准编号", name: "F_Id", width: 120, align: 'left' },
            { label: "特殊要求", name: "F_Id", width: 120, align: 'left' },
            { label: "开票毛坯数", name: "F_Id", width: 120, align: 'left' },
            { label: "开票零件数", name: "F_Id", width: 120, align: 'left' },
            { label: "开票重量(Kg)", name: "F_Id", width: 120, align: 'left' },
            { label: "实际重量(Kg)", name: "F_Id", width: 120, align: 'left' },
            { label: "开票单价(元)", name: "F_Id", width: 120, align: 'left' },
            { label: "实际单价(元)", name: "F_Id", width: 120, align: 'left' },
            { label: "零件类型", name: "F_Id", width: 120, align: 'left' },
            { label: "备注", name: "F_Id", width: 120, align: 'left' },
            ],
            //pager: "#gridPager",
            sortname: 'F_DepartmentId asc,F_CreatorTime desc',
            viewrecords: true
        });
        //默认添加空行
        for (var i = 1; i < 2; i++) {
            var rowdata = {};
            $gridList.jqGrid('addRowData', i, rowdata);
        };
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_return() {
        parent.$.detailClose();
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "选择零件",
            url: "/WareHouse/PreparBlank/AlterWindowSelectPart",
            width: "700px",
            height: "480px",
            callBack: function (iframeId) {
                var datarow = top.frames[iframeId].GetDataValue();
                var id = $('#gridList').jqGrid('getGridParam', 'selrow');
                $('#gridList').jqGrid("setRowData", id,datarow);
                $('#gridList').jqGrid("addRowData", id, {});
            }
        });
    }
    function btn_ok() {
        parent.$.detailClose();
    }
</script>
<div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
    <div class="ui-layout-center">
        <form id="form1">
            <div style="padding-top: 1px;margin-left:10px;">
                <table class="form" style="width:97%;text-align:right;margin:5px;border-bottom:2px solid #ccc;">
                    <tr>
                        <td><div style="text-align: center;font-size: 24px;"><span>入库单</span></div></td>
                        <td style="width: 300px; padding: 5px 10px; margin-top:1px;">
                            <div class="btn-group" style="margin-right:20px;">
                                <a id="" class="btn btn-primary center-block" onclick="btn_save()"><span class="glyphicon glyphicon-ok"></span> 保存</a>
                            </div>
                            <div class="btn-group">
                                <a id="" class="btn btn-primary center-block" onclick="btn_return()"><span class="glyphicon glyphicon-remove"></span> 返回</a>
                            </div>
                        </td>
                    </tr>
                </table>

                <table class="form" style="margin-top:10px;">

                    <tbody>
                        <tr>
                            <th class="formTitle" style="width:100px;">来料单位</th>
                            <td class="formValue" style="width:160px;">
                                <select style="width:207px;height:20px" tabindex="-1" class="select2-hidden-accessible" aria-hidden="true">
                                    <option value="">==请选择==</option>
                                    <option value="CL00MGWH01 马钢">CL00MGWH01 马钢</option>
                                    <option value="DFDS00WHBZ 标准件库">DFDS00WHBZ 标准件库</option>
                                </select>
                            </td>
                            <th class="formTitle" style="width:100px;">凭证编号</th>
                            <td class="formValue" style="width:160px;height:20px;">
                                <input id="" class="form-control required" value="" type="text">
                            </td>
                            <th class="formTitle" style="width:100px;">单据编号</th>
                            <td class="formValue" style="width:160px;">
                                <input id="" class="form-control required" value="" type="text">
                            </td>
                            <th class="formTitle" style="width:100px;">单据日期</th>
                            <td class="formValue" style="width:160px;">
                                <input id="" class="form-control required" value="" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th class="formTitle" style="width:100px;">发生方式</th>
                            <td class="formValue" style="width:160px;">
                                <select style="width:207px;height:20px" tabindex="-1" class="select2-hidden-accessible" aria-hidden="true">
                                    <option value="">==请选择==</option>
                                    <option value="PR 毛坯件入库">PR 毛坯件入库</option>
                                </select>
                            </td>
                            <th class="formTitle" style="width:100px;">摘要说明</th>
                            <td class="formValue" style="width:120px;height:20px;">
                                <input id="" class="form-control required" value="" type="text">
                            </td>
                            <th class="formTitle" style="width:100px;">运行单号</th>
                            <td class="formValue" style="width:120px;height:20px;">
                                <input id="" class="form-control required" value="" type="text">
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </form>
        <br />
        <div style="">
            <table id="gridList"></table>
        </div>
    </div>
</div>


